<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">
        <ui:define name="content">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form id="userView">
                <p:panel header="Information for this order:" style="text-align: center">
                    <h:panelGrid columns="2" columnClasses="column" cellpadding="5"> 
                        <h:outputText value="Vendor Name:"/>
                        &nbsp;
                        <h:outputText value="#{rawMaterialPurchaseOrderEntityController.currRpo.rmq.vendor.companyName}"/>
                        <br/>
                        <h:outputText value="Product:"/>
                        &nbsp;
                        <h:outputText value="#{rawMaterialPurchaseOrderEntityController.currRpo.rmq.rawMaterial.productName}"/>
                        <br/>
                        <p:separator/>
                        <br/>
                        &nbsp;
                        <h:outputText value="Closing Date of this order:"/>
                        &nbsp;
                        <h:outputText value="#{rawMaterialPurchaseOrderEntityController.currRpo.dateConfirmed}">
                            <f:convertDateTime pattern="dd/MM/yyyy" />
                        </h:outputText>   
                        <br/>

                        <p:separator/>
                        <br/>
                        &nbsp;
                        <h:outputText value="Total Cost:"/>
                        &nbsp;
                        <h:outputText value="#{rawMaterialPurchaseOrderEntityController.currRpo.cost}"/>
                        <br/>
                        
                        <h:outputText value="Note:"/>
                        &nbsp;
                        <h:outputText value="#{rawMaterialPurchaseOrderEntityController.currRpo.note}"/>
                        <br/>
                        
                        <h:outputText value="Order initiated by:"/>
                       <h:outputText value="#{rawMaterialPurchaseOrderEditController.selectedPurchaseOrder.createdBy.name}"/>  
                       
                       
                        <p:separator/>
                        <br/>
                        &nbsp;
                        <h:outputText value="Scheduled Shipment of this order:"/>
                        &nbsp;
                        <p:dataTable value="#{rawMaterialPurchaseOrderEntityController.scheduleShip}" var="entry" >
                            <p:column>
                                <f:facet name="header" >
                                    <h:outputText value="Shipment date:"/>
                                </f:facet>
                                <p:dataTable value="#{entry}" var="type" >
                                    <p:column>

                                        <h:outputText value="#{type.key}">
                                            <f:convertDateTime pattern="dd/MM/yyyy" />
                                        </h:outputText>

                                    </p:column>
                                </p:dataTable>
                            </p:column>
                            <p:column>
                                <f:facet name="header" >
                                    <h:outputText value="Amount:"/>
                                </f:facet>
                                <p:dataTable value="#{entry}" var="type" >
                                    <p:column>

                                        <h:outputText value="#{type.value}"/>

                                    </p:column>
                                </p:dataTable>
                            </p:column>



                        </p:dataTable>
                        
                        <br/>
                        <p:separator/>
                        <br/>
                        <br/>
                        &nbsp;
                        <h:outputText value="Actual Shipment of this order:"/>
                        &nbsp;
                        <p:dataTable value="#{rawMaterialPurchaseOrderEntityController.entrySet}" var="entry" >
                            <p:column>
                                <f:facet name="header" >
                                    <h:outputText value="Shipment date:"/>
                                </f:facet>
                                <p:dataTable value="#{entry}" var="type" >
                                    <p:column>

                                        <h:outputText value="#{type.key}">
                                            <f:convertDateTime pattern="dd/MM/yyyy" />
                                        </h:outputText>

                                    </p:column>
                                </p:dataTable>
                            </p:column>
                            <p:column>
                                <f:facet name="header" >
                                    <h:outputText value="Amount:"/>
                                </f:facet>
                                <p:dataTable value="#{entry}" var="type" >
                                    <p:column>

                                        <h:outputText value="#{type.value}"/>

                                    </p:column>
                                </p:dataTable>
                            </p:column>



                        </p:dataTable>
                        <br/>
                        <p:separator/>
                        <br/>
                        &nbsp;
                         <h:outputText value="Invoice received for this order:"/>
                        &nbsp;
                      <p:dataTable id="table"  value="#{rawMaterialPurchaseOrderEntityController.currRpo.vendorInvoices}" var="inv" 
                              
                                     >

                            <p:column >    <f:facet name="header">  
                                    <h:outputText value="Id:" /> </f:facet>
                                <h:outputText value="#{inv.externalId}" /> </p:column>


                          <p:column >   <f:facet name="header">  
                                    <h:outputText value="Amount:" /> </f:facet>
                                <h:outputText value="#{inv.amount}" /> </p:column> 
                                 <p:column >   <f:facet name="header">  
                                    <h:outputText value="Tax Amount:" /> </f:facet>
                                <h:outputText value="#{inv.taxAmount}" /> </p:column> 
                            <p:column>    <f:facet name="header">  
                                    <h:outputText value="Due Date:" /> </f:facet>
                                <h:outputText value="#{inv.dueDate}" > 
                                    <f:convertDateTime pattern="dd/MM/yyyy" />
                                </h:outputText>
                            </p:column>

                            <p:column>    <f:facet name="header">  
                                    <h:outputText value="Date Received:" /> </f:facet>
                                <h:outputText value="#{inv.dateReceived}" > 
                                    <f:convertDateTime pattern="dd/MM/yyyy" />
                                </h:outputText>
                            </p:column>
                     
                        </p:dataTable> 
                        
                          
                       <br/>
                    </h:panelGrid> 
                </p:panel>
                

                <br/>
                <br/>
                <p:commandButton action="PastOrder" ajax="false" value="Back" update="growl"/>    
                
    
            </h:form>
        </ui:define>
    </ui:composition>

</html>